import { getSvgIconText } from '@/assets/icons';
import VuiElement from '../../base/element';

/**
 * svg图标容器
 * @Author: Jevon
 * @Date: 2021-08-28 15:42:44
 */
export default class VuiSvgContainer extends VuiElement {
  /**
   * svg图标容器
   * @param {*} image
   * @param {*} className
   * @param {*} svgClassName
   * @param {*} title
   */
  constructor(image, className, svgClassName, title) {
    super();
    this._className = {
      container: className || '',
      svg: svgClassName || ''
    };
    this.initContainer(null, title || '');
    this.container.innerHTML = getSvgIconText(image, this._className.svg);
  }

  /**
   * 设置icon
   * @param {*} iconName
   */
  setIcon(iconName) {
    this.container.innerHTML = getSvgIconText(iconName, this._className.svg);
  }
}
